Skip to content

fix(hub): externalize remote-docker + digitalocean sandbox backends - #299

Closed
positonic wants to merge 1 commit into
madarco:mainfrom
positonic:fix/hub-externalize-remote-docker-backend
Closed

fix(hub): externalize remote-docker + digitalocean sandbox backends#299
positonic wants to merge 1 commit into
madarco:mainfrom
positonic:fix/hub-externalize-remote-docker-backend

Conversation

@positonic

Copy link
Copy Markdown

Problem

On a published (npm i -g @madarco/agentbox) install, any host-relay git op from a remote-docker box fails:

host executor failed: Cannot find package '@agentbox/sandbox-remote-docker'
imported from .../@madarco/agentbox/runtime/hub/apps/hub/chunk-*.js

This blocks git push / gh pr (and even read-only pr list) for remote-docker boxes, so a finished branch can't leave the box through the normal path. Fixes #298.

Root cause

The hub's provider map dynamic-imports every backend (apps/hub/lib/hub-backend.ts):

const IMPORTERS: Record<ProviderKind, ...> = {
  docker:          () => import('@agentbox/sandbox-docker'),
  daytona:         () => import('@agentbox/sandbox-daytona'),
  hetzner:         () => import('@agentbox/sandbox-hetzner'),
  vercel:          () => import('@agentbox/sandbox-vercel'),
  e2b:             () => import('@agentbox/sandbox-e2b'),
  digitalocean:    () => import('@agentbox/sandbox-digitalocean'),
  'remote-docker': () => import('@agentbox/sandbox-remote-docker'),
};

But serverExternalPackages in apps/hub/next.config.mjs listed only docker/daytona/hetzner/vercel/e2bremote-docker and digitalocean were omitted. Those two are the only providers not externalized, so on a published hub their dynamic import resolves to nothing at runtime, while the other five resolve fine.

This is the same failure class as #270 (fix(relay): inject cloud backends instead of resolving them from node_modules), which covered the CLI/relay path but not the hub's externalization list.

Fix

Add the two missing backends to serverExternalPackages so they're externalized and traced into the standalone build exactly like the other five:

     '@agentbox/sandbox-e2b',
+    '@agentbox/sandbox-digitalocean',
+    '@agentbox/sandbox-remote-docker',
   ],

Both are already declared deps of apps/hub and present in the IMPORTERS map — only the externalization entry was missing.

Validation

  • node --check apps/hub/next.config.mjs passes.
  • The change matches the exact, established pattern for the five working providers; the two broken ones were simply absent from the list.
  • I wasn't able to run a full standalone hub build locally to assert the traced output end-to-end — CI's build should confirm. Reproduced the original failure against @madarco/agentbox 0.27.1 and 0.28.0-nightly (both ship no sandbox-remote-docker).

Suggested follow-up (not in this PR)

A small guard asserting keys(IMPORTERS) ⊆ serverExternalPackages would prevent this exact omission from recurring when a new provider is added. Happy to add it if you'd like, but apps/hub has no test harness today so I kept this PR to the one-line fix.

The hub's provider IMPORTERS map (apps/hub/lib/hub-backend.ts) dynamic-imports
every @agentbox/sandbox-* backend, but serverExternalPackages in next.config.mjs
listed only docker/daytona/hetzner/vercel/e2b. sandbox-remote-docker and
sandbox-digitalocean were omitted, so on a published (npm-installed) hub their
dynamic import has nothing to resolve at runtime:

    host executor failed: Cannot find package '@agentbox/sandbox-remote-docker'
    imported from .../runtime/hub/apps/hub/chunk-*.js

Effect: every host-relay git op (git push / pr, even read-only) fails for
remote-docker boxes, so branches can't leave the box normally. Same failure
class as madarco#270 (cloud backends), which fixed the CLI/relay path but not the
hub's externalization list.

Add both missing backends to serverExternalPackages so they are externalized
and traced into the standalone build exactly like the other five providers.

Fixes madarco#298
@positonic
positonic requested a review from madarco as a code owner August 2, 2026 14:05
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
agentbox-web Skipped Skipped Aug 2, 2026 2:05pm

Request Review

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

Thanks for your pull request. Before it can be merged, please read our Contributor License Agreement and sign it by posting the comment below. You only ever have to do this once.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@positonic

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@positonic positonic closed this Aug 2, 2026
@positonic

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 2, 2026
@positonic positonic reopened this Aug 2, 2026
@positonic positonic closed this Aug 2, 2026
@madarco

madarco commented Aug 3, 2026

Copy link
Copy Markdown
Owner

@positonic thanks this looks a fix needed, should we reopen?

@madarco

madarco commented Aug 3, 2026

Copy link
Copy Markdown
Owner

nvm this fix wasn't enough, I've released a patch on v0.27.2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloud/remote-docker git ops fail on stable with "Cannot find package '@agentbox/sandbox-*'" — fixed by #270, needs a stable release

2 participants